package com.bo.activity;



import com.bo.activity.R;
import com.bo.entity.CompanyInt;
import com.bo.entity.Mark;
import com.bo.entity.SelectModel;
import com.bo.util.LoadResourceProxy;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.widget.ImageView;
import android.widget.TextView;


public class CompanyIntActivity extends MyBaseActivity{
	
	private Mark mark;
	
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
	    CompanyInt companyInt=null;
	    
		String companyId=this.getIntent().getStringExtra("companyId");
		String companyName=this.getIntent().getStringExtra("companyName");
		
		mark=new Mark(companyId,companyName,null,null);
	    
	    try{

	    	companyInt=new CompanyInt().createCompanyInt(companyId);
	    	
	        switch(companyInt.getModel()){
	        
	          case SelectModel.ONE_IMG_TITLE_CONTENT:{
	        	  
	        	  this.setContentView(R.layout.cpi_one_img_with_text);
	        	  
	              ImageView img=(ImageView)this.findViewById(R.id.cpi_0_img_1);
	        	  
	        	  img.setImageBitmap(LoadResourceProxy.getImage(LoadResourceProxy.COMPANY_INT
	        		                ,companyInt.getCompanyId(),companyInt.getId(),1,companyInt.getImageList().get(0))); 
	        	  
	        	   
	        	  TextView title=(TextView)this.findViewById(R.id.cpi_0_title);
	        	  
	        	  title.setText(companyInt.getTitle());
	        	  
	              TextView content=(TextView)this.findViewById(R.id.cpi_0_content);
	        	  
	        	  content.setText(companyInt.getContent());
	        	  
	          };break;
	        
	          case SelectModel.TWO_IMG_TITLE_CONTENT:{
	        	  
	        	  this.setContentView(R.layout.cpi_two_img_with_text);

	        	  TextView title=(TextView)this.findViewById(R.id.cpi_1_title);
	        	  
	        	  title.setText(companyInt.getTitle());
	        	  
	              TextView content=(TextView)this.findViewById(R.id.cpi_1_content);
	        	  
	        	  content.setText(companyInt.getContent());
	        	  
                  ImageView img1=(ImageView)this.findViewById(R.id.cpi_1_img_1);
	        	  
	        	  img1.setImageBitmap(LoadResourceProxy.getImage(LoadResourceProxy.COMPANY_INT
	        			  ,companyInt.getCompanyId(),companyInt.getId(),1,companyInt.getImageList().get(0))); 
	        	  
                  ImageView img2=(ImageView)this.findViewById(R.id.cpi_1_img_2);
	        	  
	        	  img2.setImageBitmap(LoadResourceProxy.getImage(LoadResourceProxy.COMPANY_INT
	        			  ,companyInt.getCompanyId(),companyInt.getId(),2,companyInt.getImageList().get(1))); 
	        	  
	          };break;
	        }
	    
	    }catch(Exception e){
	    	
	    	//Log.i("error",e.getMessage());
	    }
	}

	
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu){
		
		return this.menuInit(menu, true);
	}
	
	
	@Override
	protected Mark getMark() {
		
		return mark;
	}
	

	
}
